<template>
  <div id="container" style="height: 400px">
    <el-button @click="toExcel">导出excel</el-button>
  </div>
</template>

<script>
  // import XLSX from 'xlsx'
  // import XLSXStyle from 'xlsx-style'
  export default {
    name: "exportExcel",
    components: {

    },
    data() {
      return {
        res_data : [
          {'ctime':'2020-01-12','new_count':'12','online_count':'12','total_count':'12'},
          {'ctime':'2020-01-13','new_count':'12','online_count':'12','total_count':'13'},
          {'ctime':'2020-01-14','new_count':'12','online_count':'12','total_count':'14'},
          {'ctime':'2020-01-15','new_count':'12','online_count':'12','total_count':'15'}
        ]
      }
    },
    methods: {
      toExcel(){
        // let aaa= XLSX.utils.book_new()
        // let bbbb = XLSX.utils.json_to_sheet(this.res_data)
        // XLSX.utils.book_append_sheet(aaa,bbbb,"111")
        // XLSX.writeFile(aaa,"2222.xlsx")

        // let wb = XLSX.utils.book_new()
        // let cws = XLSX.utils.json_to_sheet(this.res_data)
        // XLSX.utils.book_append_sheet(wb,cws,"111")
        // XLSX.writeFile(wb,"2222.xlsx")
      }

    },
    mounted() {
      // this.toExcel()
    }
  }
</script>

<style scoped>

</style>
